# for a "singleton" config object
import ConfigParser

config = ConfigParser.ConfigParser()
#####################################################################
config.add_section('vars')
#####################################################################
#Executable for running with the option vmType=kvm
config.set('vars', 'vtexec', '/usr/libexec/qemu-kvm -no-hpet')
#Executable for running with the option vmType=qemu
config.set('vars', 'qemuexec', '/usr/bin/qemu')
# additional spice params, copied verbatim to commandline
config.set('vars', 'extra_spice_params', '')
#Executable for image manipulation
config.set('vars', 'qemuimg', '/usr/bin/qemu-img')
#logCollector
config.set('vars', 'log_collector', '/usr/share/vdsm/logCollector.sh')
#Enable core dump
config.set('vars', 'core_dump_enable', 'true')
#Base value for the TAP interface connection and the VNC display ID
config.set('vars', 'if_and_display_base', '10')
#This reserves memory for the host to prevent the
#VMs from using all the physical pages.
#The values are in Mbytes
config.set('vars', 'host_mem_reserve', '256')
config.set('vars', 'guest_ram_overhead', '65')
#memory reserved for non-vds-administered programs
config.set('vars', 'extra_mem_reserve', '0')

#NIC model is rtl8139, ne2k_pci pv or any other valid device recognized by kvm/qemu
#if a coma separated list given then a NIC per device will be created
config.set('vars', 'nic_model', 'rtl8139,pv')
#match_mtu will set MTU size for the tap interface equal of brigde MTU size
config.set('vars', 'match_mtu', 'false')
#time to wait for qemu monitor socket
config.set('vars', 'create_timeout', '30')
#This locks the KVM to single CPU if true.
config.set('vars', 'lock_cpu', 'false')
#Create USB tablet
config.set('vars', 'usbdevice_tablet', 'false')
# migration_timeout: maximum time the destination waits for migration to end.
# source waits twice as long (to avoid races)
config.set('vars', 'migration_timeout', '300')
# time to wait (in seconds) for migration destination to start listening before
# migration begins.
config.set('vars', 'migration_listener_timeout', '30')

# maxmium allowed downtime for live migration (anything below 100ms is ignored)
# if you do not care about liveness of migration, set to a very high value,
# such as 600s
config.set('vars', 'migration_downtime', '500ms')

# maximum concurrent outgoing migrations
config.set('vars', 'max_outgoing_migrations', '5')

#Destroy/Shutdown timeouts defines timeout (in sec) before complete VM destroying/shutdowning
config.set('vars', 'sys_shutdown_timeout', '10')
config.set('vars', 'user_shutdown_timeout', '30')
# time (in sec) to wait for guest agent. default is 30 seconds
config.set('vars', 'guest_agent_timeout', '30')
config.set('vars', 'migrationLowPort', '49152')
config.set('vars', 'migrationHighPort', '49216')

#Use Fixed TAP name. Values = none, guid, name.
config.set('vars', 'use_fixed_tap', 'none')
#Location of network information file
config.set('vars', 'kvm_switch', '/etc/sysconfig/kvm')

# time to wait (in seconds) for vm to respond to a monitor command.
# 30 secs is a nice default.
# set to 300 if the vm is expected to freeze during cluster failover
config.set('vars', 'vm_command_timeout', '60')

# how often should we sample each vm for statistics (seconds)
config.set('vars', 'vm_sample_interval', '2')

# where the certificates and keys are situated
config.set('vars', 'trust_store_path', '/var/vdsm/ts')
# whether to use ssl encryption and authentication. default is true
config.set('vars', 'ssl', 'true')

# debug scripts to be run just before running a vm, and just after stopping it
config.set('vars', 'pre_vm', '')
config.set('vars', 'post_vm', '')

config.set('vars', 'vds_responsiveness_timeout', '60')

config.set('vars', 'vdsm_nice', '-5')

config.set('vars', 'qemu_drive_cache', 'off')

config.set('vars', 'mem_overcommit_protection', 'false')

config.set('vars', 'fake_kvm_support', 'false')
#####################################################################
config.add_section('ksm')
#####################################################################
config.set('ksm', 'ksm_enable', 'true')

# sleep interval (microseconds) between ksm iterations.
# specify here the sleep interval for 16gb host; the actual sleep interval is
# inversely proportional to host memory size.
config.set('ksm', 'ksm_sleep', '10000')
# niceness of the kksmd thread
config.set('ksm', 'ksm_nice', '0')
# ksm controlling program
config.set('ksm', 'ksm_prog', '/usr/bin/ksmctl')
# When a new vm is launched, it is worth to wait for ksm to do its work:
# time (in sec) to wait for memory to be freed by ksm
config.set('ksm', 'ksm_launch_timeout', '50')

# start ksm when:
# (phys - committed) < ksm_thres_coef percent * physical_mem
#   or
# (phys - committed) <  ksm_thres_const (in Mb)
config.set('ksm', 'ksm_thres_coef', '20')
config.set('ksm', 'ksm_thres_const', '2048')

config.set('ksm', 'ksm_monitor_thread', 'true')

# number of pages to be scanned in each ksm iteration:
config.set('ksm', 'ksm_npages_max', '2500')
config.set('ksm', 'ksm_npages_min', '64')
config.set('ksm', 'ksm_npages_boost', '600')
config.set('ksm', 'ksm_npages_decay', '-120')

#####################################################################
config.add_section('irs')
#####################################################################
config.set('irs', 'irs_enable', 'true')

#Irs throttling during copy. Set the active time vs idle time
config.set('irs', 'active', '1.0')
config.set('irs', 'idle', '1.0')
config.set('irs', 'keepalive', '1')

#Image repository
config.set('irs', 'repository', '/rhev/data-center')
config.set('irs', 'hsm_tasks', '%(repository)s/hsm-tasks')
config.set('irs', 'images', '/images')
config.set('irs', 'irsd', '%(images)s/irsd')
#Image repository check period [seconds]
config.set('irs', 'images_check_times', '0')

config.set('irs', 'volume_utilization_percent', '80')
config.set('irs', 'volume_utilization_chunk_mb', '1024')
config.set('irs', 'lv_extend_moratorium', '60')

# how often should volume's size be checked (seconds
config.set('irs', 'vol_size_sample_interval', '60')

config.set('irs', 'sd_metadata_lifetime_sec', '300')
config.set('irs', 'remote_file_handler_timeout', '30')
config.set('irs', 'remote_file_handlers_num', '100')

# StorageDomain Validate Timeout
# sd_validate_timeout = n
# n - maximum number of seconds to wait until all the domains will be validated
# Default: 80 - wait up to 80 seconds
#
config.set('irs', 'sd_validate_timeout', '80')
#
# Storage Domain Health Check delay
# The amount of seconds to wait between two successive run of the domain health check
# sd_health_check_delay = n
# Default: 10 (secs)
config.set('irs', 'sd_health_check_delay', '10')

#
# NFS mount options
# nfs_mount_options = comma-separated list (NB no white space allowed !)
#
# Default: soft,timeo=600,retrans=2,nosharecache
#
config.set('irs', 'nfs_mount_options', 'soft,timeo=600,retrans=2,nosharecache')

config.set('irs', 'pools_data_dir', '@POOLSDIR@')
config.set('irs', 'vol_extend_policy', 'ON')
config.set('irs', 'lock_util_path', '@LIBEXECDIR@')
config.set('irs', 'lock_cmd', 'spmprotect.sh')
config.set('irs', 'free_lock_cmd', 'spmstop.sh')
config.set('irs', 'thread_pool_size', '10')
config.set('irs', 'max_tasks', '500')
config.set('irs', 'int_thread_pool_size', '10')
config.set('irs', 'int_max_tasks', '100')
config.set('irs', 'lvm_dev_whitelist', '')
config.set('irs', 'md_backup_versions', '30')
config.set('irs', 'md_backup_dir', '@BACKUPDIR@')
config.set('irs', 'maximum_allowed_pvs', '8')

config.set('irs', 'task_resource_default_timeout', '120000')
config.set('irs', 'spm_stop_task_resource_timeout', '300000')

#####################################################################
config.add_section('netconsole')
#####################################################################
config.set('netconsole', 'netconsole_enable', 'false')

#####################################################################
config.add_section('addresses')
#####################################################################
#Port on which the vdsmd XMPRPC server listens to network clients
config.set('addresses', 'management_port', '54321')
config.set('addresses', 'management_ip', '')
config.set('addresses', 'guests_gateway_ip', '')
config.set('addresses', 'network_stats_collection', '')
